<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--出租车，起步价(2公里以内)为7元，超过2公里的按照每公里3元计算。要求根据路程计算费用-->
<script>

    var num = window.prompt("请输入公里数")
    if(num*1<=2){
        console.log("车费7元")
    }else{
        var money = (num - 2) * 3  + 7
        console.log("车费"+money+"元")
    }

</script>

</body>
</html>